<?php
declare (strict_types = 1);

namespace app\admin\validate\maichen;

use think\Validate;

class Product extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名'	=>	['规则1','规则2'...]
     *
     * @var array
     */	
	protected $rule = [
        'name' => ['require', 'length:4, 25'],
        'material' => ['require', 'length: 2, 18'],
        'manufacturer' => ['require', 'length: 2, 18'],
        'shop_no' => ['require', 'length: 11'],
    ];
    
    /**
     * 定义错误信息
     * 格式：'字段名.规则名'	=>	'错误信息'
     *
     * @var array
     */	
    protected $message = [
        'name.require' => '商品名称是必选项',
        'material.require' => '材质是必选项',
        'manufacturer.require' => '厂家是必选项',
        'shop_no.require' => '店管家号是必选项',
        'name.length' => '商品名称必须在 4 到 25 个字符之间',
        'material.length' => '材质必须在 2 到 18 个字符之间',
        'manufacturer.length' => '厂家必须在 2 到 18个字符之间',
        'shop_no.length' => '店管家号必须是11位',
    ];
}
